package com.finance.system.service;

import com.finance.system.bean.pojo.RecomputeTask;
import com.finance.system.bean.pojo.User;
import com.finance.system.dao.RecomputeTaskMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by CBWL on 2017/5/26.
 */
@Service
public class RecomputeTaskService implements IRecomputeTaskService {
    private Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    private RecomputeTaskMapper recomputeTaskMapper;

    @Override
    public boolean addRecomputeTask(RecomputeTask recomputeTask, User user) {
        boolean result = false;
        try{
            result = this.recomputeTaskMapper.addRecomputeTask(recomputeTask,user)==1;
        }catch (Exception e){
            this.logger.info("插入记录错误{}",e.getMessage());
        }
        return result;
    }

    @Override
    public boolean updateRecomputeTask(RecomputeTask recomputeTask, User user) {
        return this.recomputeTaskMapper.updateRecomputeTask(recomputeTask,user) == 1;
    }

    @Override
    public RecomputeTask getByMonth(String month) {
        return this.recomputeTaskMapper.getByMonth(month);
    }

    @Override
    public List<RecomputeTask> getAllUnPull() {
        return this.recomputeTaskMapper.getAllUnPull();
    }

    @Override
    public List<RecomputeTask> getAllUnCompute() {
        return this.recomputeTaskMapper.getAllUnCompute();
    }

    @Override
    public void delByMonth(String month) {
        this.recomputeTaskMapper.delByMonth(month);
    }

}
